A media access control (Media Access Control, MAC) address is a unique address assigned to a network device during the delivery, with the length of 48 bits, and is used to identify a network device. Each network device has a unique MAC address.
A process of learning a MAC address by a switch may be specifically as follows: A user sends from port 1 a packet whose source MAC address (Source Address, SA for short) is MAC B, destination MAC address (Destination Address, DA for short) is MAC A, and virtual local area network (Virtual Local Area Network, VLAN for short) is 1; the switch learns the SA of the packet, and establishes a MAC address forwarding table, where the MAC address forwarding table may include such information as SA, VLAN, and port; then the switch may implement unicast forwarding on the packet according to the MAC address forwarding table. Currently, the MAC address forwarding table of the switch is generally stored in a static random access memory (Static Random Access Memory, SRAM for short) or a dynamic random access memory (Dynamic Random Access Memory, DRAM for short). In consideration of capacity and search efficiency, entry storage and search in the MAC address forwarding table generally are implemented by using a Hash algorithm.
The Hash algorithm may establish a many-to-one mapping between a keyword set and a Hash index, that is, one keyword set may only correspond to one Hash index, but one Hash index may correspond to multiple different keyword sets. When different keyword sets correspond to a same Hash index value, a Hash conflict occurs. When a Hash conflict occurs, a corresponding MAC address forwarding table cannot be learned, which causes a forwarding failure and further results in that a user cannot access the Internet or the Internet speed is very low.